<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var str = 'abcd'
        switch (str) {
            case 'a' :
                console.log('我是a');
                break;
            case 'ab' :
                console.log('我是ab');
                break;
            case 'abcd' :
                console.log('我是abc');
                break;
            default :
                console.log('啥都不是');        
        }
    </script>
</body>
</html>